<template>
    <div>
        <page-header :title="$route.meta.title" content="" />
        <page-main>
            <el-button type="primary" style="margin-bottom: 10px;" icon="el-icon-plus" @click="onCreate">新增</el-button>
            <!-- <search-bar>
                <el-form :model="form" size="small" label-width="100px" label-suffix="：">
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="名称">
                                <el-input v-model="form.name" placeholder="请输入名称" clearable @keydown.enter.native="refresh" @clear="refresh" />
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" @click="refresh">筛 选</el-button>
                    </el-form-item>
                </el-form>
            </search-bar> -->
            <el-table ref="table" v-loading="loading" class="list-table" :data="listData" border stripe highlight-current-row>
                <el-table-column type="index" width="50" label="#" />
                <el-table-column prop="name" label="名称" />
                <el-table-column prop="remarks" label="备注" />
                <el-table-column prop="weigh" label="权重" align="center" />
                <el-table-column label="状态" width="200" align="center">
                    <template slot-scope="scope">
                        <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="onChangeStatus(scope.row)" />
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="200" align="center">
                    <template slot-scope="scope">
                        <el-button type="primary" size="mini" plain @click="onEdit(scope.row)">编辑</el-button>
                        <el-button type="danger" size="mini" plain @click="onDel(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination
                :current-page.sync="page.page"
                :total="page.total"
                :page-size.sync="page.size"
                :page-sizes.sync="page.sizes"
                layout="total, sizes, ->, prev, pager, next, jumper"
                background
                @size-change="refresh"
                @current-change="getDataList"
            />
        </page-main>
        <FormDialog :id="detailFormDialog.id" :visible.sync="detailFormDialog.visible" @success="getDataList" />
    </div>
</template>

<script>
import mixin from '@/mixins/mixin'
import FormDialog from './components/FormDialog/index'

export default {
    components: {
        FormDialog
    },
    mixins: [mixin],
    data() {
        return {
            form: {
                name: ''
            },
            api: {
                list: 'product/tags/tabulation',
                del: 'product/tags/delete',
                changeStatus: 'product/tags/change-status'
            }
        }
    },
    created() {
        this.getDataList()
    },
    methods: {

    }
}
</script>

<style lang="scss" scoped>
    .el-pagination {
        margin-top: 20px;
    }
</style>
